//
// Created by xili on 2024/8/31 17:24.
// GO BIG OR GO HOME.
//
#include "leetcode.h"

class Solution {
public:
    string largestOddNumber(string num) {
        int n = num.size();
        int r = n - 1;
        while (r >= 0) {
            if ((num[r] - '0') % 2) {
                break;
            }
            r--;
        }
        return r >= 0 ? num.substr(0, r + 1) : "";
    }
};